macheteYeti / [LWAF] WP Helper Buttons

// ==UserScript==
// @name         [LWAF] WP Helper Buttons
// @namespace    SUD
// @license MIT
// @include https://livewellandfully.com/wp-admin/*
// @include https://members.livewellandfully.com/wp-admin/*
// @include https://go.livewellandfully.com/wp-admin/*
// @require http://code.jquery.com/jquery-3.4.1.min.js
// @require     https://cdnjs.cloudflare.com/ajax/libs/arrive/2.4.1/arrive.min.js
// @downloadURL https://openuserjs.org/install/macheteYeti/[LWAF]_WP_Helper_Buttons.user.js
// @updateURL https://openuserjs.org/install/macheteYeti/[LWAF]_WP_Helper_Buttons.user.js
// @version 3
// @grant GM_addStyle
// @author       macheteYeti
// @license MIT
// @description  Adds functions to traverse between ThriveCart and WP Folders
// ==/UserScript==

$(document).ready(function(){

	var urlParams = new URLSearchParams(window.location.search);
	var domain=window.location.href.split('.com')[0];
	
	if(typeof urlParams.get('post')!=typeof undefined&&urlParams.get('post')!=null&&urlParams.get('post').length>0){
	
		var act=urlParams.get('action');
		var id=urlParams.get('post');
		
		if(act=='edit'){
		
			console.log('found wp editor');
			var folder=$('#wf_page_folderschecklist input:checked').first().val();
			console.log(folder);
			$(document).on('click','#wf_page_foldersdiv h2 a',function(e){
			
				console.log('opening folder');
				$('#wf_page_foldersdiv h2').trigger('click');
			});
			$('#wf_page_foldersdiv h2').append('<a href="'+domain+'.com/wp-admin/edit.php?s&post_status=all&post_type=page&action=-1&m=0&wicked_page_folder_filter='+folder+'&seo_filter&readability_filter&paged=1&action2=-1">Open Folder</a>');
		}
		else if(act='architect'){
		
			$('.bottom').prepend('<a href="'+domain+'.com/wp-admin/post.php?post='+id+'&action=edit" data-position="left" class="sidebar-item click" data-tooltip="Open WordPress">WP</a>');
		}
	}
});

GM_addStyle( `
   
` );